use std::net::{TcpStream, Shutdown};
use std::io::{Write, Read};


fn main() {
    let mut stream = TcpStream::connect("127.0.0.1:27015").expect("connect failed!");
    let write_size = stream.write(b"this is a test").expect("write failed!");
    println!("Bytes Sent: {write_size}");
    stream.shutdown(Shutdown::Write).expect("shutdown failed!");
    let mut buf = Vec::new();
    let read_size = stream.read_to_end(&mut buf).expect("read failed!");
    assert_eq!(read_size, buf.len());
    println!("Bytes Received: {read_size}");
}
